package com.example.demo.Thread;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * @Description
 * @Author
 * @Date 2020/2/27 15:11
 **/
public class Util {
    private volatile List<String> str;

    private Util() {
        super();
    }

    private static Util util;
    public static Util getUtil(){
        if(util ==null){
            return new Util();
        }
        return util;
    }
    public List<String> get(){
//        synchronized (this.getClass()){
            return str;
//        }
    }
    public void set(String s){
//        synchronized (this.getClass()){
            Random random = new Random();
            String sss=Thread.currentThread().getName()+":set"+s;
            System.out.println(sss);
            for (int i = 0; i < 100000; i++) {
                sss=sss+1;
            }
            str = Arrays.asList(sss.split("|"));

//        }
    }
}
